package him.works.trainapp;

import java.util.ArrayList;

import android.app.ListFragment;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;

public class ResultFragment extends ListFragment {
	
	Bundle bundleResult = null;
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		return super.onCreateView(inflater, container, savedInstanceState);
	}

	@Override
	public void onActivityCreated(Bundle bundle) {

		super.onActivityCreated(bundle);
		ArrayList<String> listResult = bundleResult
				.containsKey(Utils.NAME_RESULT_SET) ? bundleResult
				.getStringArrayList(Utils.NAME_RESULT_SET)
				: new ArrayList<String>();
		
		Log.i("BANANA", "Result of request is : " + listResult);
		setListAdapter(new ArrayAdapter<String>(getActivity(),
				android.R.layout.simple_list_item_1,
				listResult));
	}

	public void passDataToFragment(Bundle bundle) {
		bundleResult = bundle;
	}	
}